package com.ppmall.task;


import com.ppmall.dao.CartMapper;
import com.ppmall.util.DateUtil2;
import com.ppmall.util.SpringApplicationContextHolder;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ScheduleTask implements Runnable{
    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public ScheduleTask(String id) {
        this.id = id;
    }

    public ScheduleTask() {
    }



    @Override
    public void run() {
        CartMapper mapper = (CartMapper) SpringApplicationContextHolder.getSpringBean("cartMapper");
        mapper.deleteByPrimaryKey(Integer.parseInt(this.id));
        System.out.println(id + "start" + DateUtil2.parseDateToStr(new Date(), DateUtil2.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI_SS));
    }
}
